<?php include './application/views/common/zhs_header.php';?>

<?php include './application/views/common/zhs_usercenter_acnt.php';?>
<div class="inv_box w">
<?php include './application/views/common/zhs_usercenter_left.php';?>
  <div class="membd_right">
     <h3 class="membdrg_tit">支付密码找回</h3>
    <div class="mem_perbox">
    <?php if(isset($user['email']) && $user['email'] != ""){?>
  <form id="my_form">
	<input type="hidden" name="act" value="mail">
		<div class="user_right_border">
			<div class="l">您的邮箱：</div>
			<div class="c">
				<?php echo $user['email']; ?>
			</div>
		</div>
		
		<div class="user_right_border">
			<div class="l">验证码：</div>
			<div class="c">
				
				<div style="float: left;"><input type="text" id="captcha" name="captcha" style="width:70px; height:27px;" maxlength="4"></div>
				<div style="float: left;margin-left: 10px; margin-top:4px;"><img src="/yanzheng/index/" id="imgCode" onclick="changeImage();" style="border:0;padding:0px;cursor:pointer;"/></div>
				
			</div>
		</div>
		
		<div class="user_right_border">
			<div class="l"></div>
			<div class="c">
			<input style="cursor:pointer" class="little_button" type="button" size="30" value="确认提交" onclick="toSubmit();">
			</div>
		</div>
</form>

<script>
function toSubmit(){
	var options = {
		url : GetUrlRelativePath(),
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						if(ret.url==''){
							window.location.reload();
						}else{
							window.location=ret.url;
						}
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#my_form").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if($('#captcha').val()==''){
		err = '请输入验证码';
	}
	
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true,
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}},
			close: function() {
				$("#my_form").resetForm();
			}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>
<?php } else {?>
	<a href="/user/zhs_email.html">请认证邮箱再找回交易密码</a>
<?php }?>
   </div>
</div> 
</div>

<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>
    